{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib\n",
    "import numpy\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "matplotlib.style.use('ggplot')\n",
    "matplotlib.rcParams.update({'font.size': 12})\n",
    "matplotlib.rcParams.update({'xtick.labelsize': 'x-large'})\n",
    "matplotlib.rcParams.update({'xtick.major.size': '0'})\n",
    "matplotlib.rcParams.update({'ytick.labelsize': 'x-large'})\n",
    "matplotlib.rcParams.update({'ytick.major.size': '0'})\n",
    "matplotlib.rcParams.update({\"text.usetex\": True})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# Ramp\n",
    "Lx = 40\n",
    "Ly = 30\n",
    "Lz = 20\n",
    "xy = 0.7\n",
    "xz = 0.2\n",
    "yz = 0.3\n",
    "\n",
    "a1 = numpy.array([Lx, 0, 0])\n",
    "a2 = numpy.array([xy * Ly, Ly, 0])\n",
    "a3 = numpy.array([xz * Lz, yz * Lz, Lz])\n",
    "\n",
    "verts = numpy.zeros(shape=(8,3))\n",
    "verts[0,:] = [0,0,0]\n",
    "verts[1,:] = a1\n",
    "verts[2,:] = a1 + a2\n",
    "verts[3,:] = a2\n",
    "verts[4,:] = a3\n",
    "verts[5,:] = a1 + a3\n",
    "verts[6,:] = a1 + a2 + a3\n",
    "verts[7,:] = a2 + a3\n",
    "\n",
    "lines = [[0, 1, 'C1'], [1, 2, 'C0'], [2, 3, 'C0'], [3, 0, 'C1'], [4, 5, 'C0'], [5, 6, 'C0'], [6, 7, 'C0'], [7, 4, 'C0'], [0, 4, 'C1'], [1, 5, 'C0'], [2, 6, 'C0'], [3, 7, 'C0']]\n",
    "\n",
    "fig = matplotlib.figure.Figure(figsize=(10, 6.18), dpi=100)\n",
    "ax = fig.add_subplot(projection='3d', proj_type='ortho')\n",
    "for line in lines:\n",
    "    ax.plot([verts[line[0],0], verts[line[1],0]],\n",
    "            [verts[line[0],1], verts[line[1],1]],\n",
    "            [verts[line[0],2], verts[line[1],2]], color=line[2])\n",
    "\n",
    "origin = a1 / 2 + a2 / 2 + a3 / 2\n",
    "ax.text(*origin, r'$\\vec{0}$')\n",
    "ax.text(*(a1 + [-4,1,0]), r'$\\vec{a}_1$')\n",
    "ax.text(*(a2 + [-1,-4,0]), r'$\\vec{a}_2$')\n",
    "ax.text(*(a3 + [4, 0, -1]), r'$\\vec{a}_3$')\n",
    "\n",
    "ax.plot([0, Lx], [0, 0], Lz+2, color='C3')\n",
    "ax.text(Lx/2, 0, Lz, r'$L_x$')\n",
    "\n",
    "ax.plot([Lx+a2[0]+4, Lx+a2[0]+4], [0, Ly], 0, color='C3')\n",
    "ax.text(Lx+a2[0]-2, Ly/2, 0, r'$L_y$')\n",
    "\n",
    "ax.plot([0, 0], [Ly, Ly], [0, Lz], color='C3')\n",
    "ax.text(4, Ly, Lz/2, r'$L_z$')\n",
    "\n",
    "ax.set_xlabel('X')\n",
    "ax.set_ylabel('Y')\n",
    "ax.set_zlabel('Z')\n",
    "ax.set_xticklabels([])\n",
    "ax.set_yticklabels([])\n",
    "ax.set_zticklabels([])\n",
    "ax.view_init(azim=20, elev=20, vertical_axis='y')\n",
    "ax.set_facecolor('white')\n",
    "\n",
    "fig"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "fig.savefig('../box.svg', bbox_inches='tight')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
